package com.yunweiweishi.xuhuanpaltform.yuhuan_app.service.imp;

import com.yunweiweishi.xuhuanpaltform.yuhuan_app.dao.FlightDao;
import com.yunweiweishi.xuhuanpaltform.yuhuan_app.pojo.Flights;
import com.yunweiweishi.xuhuanpaltform.yuhuan_app.service.FlightsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.Optional;


@Service
@Transactional
public class FlightsServiceImpl implements FlightsService {



    @Autowired
    private FlightDao flightDao;


    @Override
    public Optional<Flights> findFlightsByPatrolRouteId(Long patrolRouteId) {
        return flightDao.findById(patrolRouteId);
    }


    /**
     * 添加班次
     * @param flights
     */
    @Override
    public void addFlightsTask( Flights flights) {
        flightDao.save(flights);

    }


    /**
     * 通过id对班次进行更新
     * @param flights
     */

    @Override
    public void updateFlightsById(Flights flights) {
        flightDao.save(flights);

    }


    /**
     * 通过id进行删除
     * @param id
     */
    @Override
    public void deleteFlightsById(Long id) {
        flightDao.deleteById(id);

    }


}
